﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VolunteerHubAdapter.MVVM.ViewModels
{
    public abstract class WorkspaceViewModel : ViewModelBase
    {
        #region " Close Command "
        public event Action RequestClose;

        private Commands.RelayCommand _closeCommand;
        public System.Windows.Input.ICommand CloseCommand
        {
            get
            {
                if (_closeCommand == null)
                {
                    _closeCommand = new Commands.RelayCommand(param => Close(), param => CanClose());
                }
                return _closeCommand;
            }
        }

        public virtual void Close()
        {
            if (RequestClose != null)
            {
                RequestClose();
            }
        }

        public virtual bool CanClose()
        {
            return true;
        }
        #endregion
    }
}
